/**
 * 给定一个树，red每次移动一格，purple每次最多移动二格，
 * 问puple能否追上red，在red到达叶子之前
 * 
 * 以purple为根，令DLeaf[i]为i到最近叶子的距离，Dist[i]为根到i的距离
 * 考虑red的胜利策略，只有2种可能
 * 1. 直接向远离purple的位置走，且purple追不上，此时 Dist[red] >= DLeaf[red]
 * 2. 向根的方向走到某个p节点，然后调头走向距离p最近的叶子，且purple追不上，此时照样有一个条件
 * 依次枚举判断即可。
 */
#include <bits/stdc++.h>
using namespace std;

using llt = long long;
using vi = vector<int>;

vector<vi> G;
int N;
int Red, Purple;
vi Degree;
vi DLeaf;
vi Dist;
vi Father;

void dfsDist(int u, int p){
    Dist[u] = Dist[Father[u] =p] + 1;
    int tmp = N + N;
    for(auto i : G[u]){
        if(i == p) continue;
        dfsDist(i, u);
        tmp = min(tmp, DLeaf[i]);
    }
    if(tmp == N + N) DLeaf[u] = 0;
    else DLeaf[u] = tmp + 1;
    return;
}

void work(){
    cin >> N >> Red >> Purple;
    G.assign(N + 1, {});
    Degree.assign(N + 1, 0);
    for(int a,b,i=1;i<N;++i){
        cin >> a >> b;
        G[a].push_back(b);
        G[b].push_back(a);
        Degree[a] += 1;
        Degree[b] += 1;
    }
    if(1 == Degree[Red]) return (void)(cout << "red" << endl);

    Father.assign(N + 1, -1);
    DLeaf.assign(N + 1, -1);
    Dist.assign(N + 1, -1);
    dfsDist(Purple, 0);

    if(Dist[Red] >= DLeaf[Red]) return (void)(cout << "red" << endl);
    
    int u = Red;
    while(1){
        int p = Father[u];
        if(0 == p) break;

        int x = Dist[u] - Dist[p];
        x += DLeaf[p];
        if(Dist[p] >= x) return (void)(cout << "red" << endl);
        u = p;
    }
    cout << "purple" << endl;
    return;
}

int main(){
#ifndef ONLINE_JUDGE
    freopen("z.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);	
    int nofkase = 1;
    cin >> nofkase;
    while(nofkase--) work();
	return 0;
}